import TaskStateEnum from '@model/enum/TaskStateEnum.ts';
import { cloneDeep } from 'lodash'
import { resetResultFile } from '@src/util/uploader'
export const switchState = (state)=>{
    return TaskStateEnum.getName(state)
}

export const localeToHttp = (formValue)=>{
    let res = cloneDeep(formValue)
    // if(res.remindUsers?.length){
    //     res.remindUsers = res.remindUsers.map(item=>item.userId)
    // }
    if(res.qualification?.length){
        res.qualificationId = res.qualification.map(item=>item.value).join('')
        delete res.qualification
    }
    if(res.attachments?.length){
        res.attachments = res.attachments.map(item=>resetResultFile(item))
    }
    
    
    return res
}